﻿cmake_minimum_required (VERSION 3.8)
project ("Chat")
set(CMAKE_CXX_STANDARD 17)
# Global setting
if(MSVC)
	# /Zc:preprocessor: 需要这个才可以正常使用 __VA_ARGS__
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /Zc:preprocessor")
else()
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -O3 -Wall -g")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
	option(DESTRIBUTED_DEBUG "Debug Mod" ON)
else()
	option(DESTRIBUTED_DEBUG "Debug Mod" OFF)
endif()

set(PREFIX_PATH "D:\\DevelopmentKits\\Qt\\5.15.2\\msvc2019_64"
				"C:\\vcpkg\\vcpkg\\installed\\x64-windows"
)
set(CMAKE_PREFIX_PATH ${PREFIX_PATH})

list(APPEND GLOBAL_INCLUDE)
list(APPEND GLOBAL_LIB)

#include(./cmake/FindQt.cmake)
include(./cmake/FindPoco.cmake)
include(./cmake/GetExecName.cmake)
include(./cmake/GetShareLibraryName.cmake)
include(./cmake/GetStaticLibraryName.cmake)
# 设置Qt
#set(QtComponents Core Widgets Gui)
#FindQt(5 "${QtComponents}")

list(APPEND GLOBAL_INCLUDE ${QtIncludes})
list(APPEND GLOBAL_LIB ${QtLibs})

set(PocoComponents Net JSON Foundation Util)
FindPoco("${PocoComponents}")

list(APPEND GLOBAL_INCLUDE ${PocoIncludes})
list(APPEND GLOBAL_LIB ${PocoLibs})

# End Global setting
link_directories("C:\\vcpkg\\vcpkg\\installed\\x64-windows\\lib")
#link_directories("C:\\vcpkg\\vcpkg\\installed\\x64-windows\\debug\\lib")
include_directories(${GLOBAL_INCLUDE})
# 需要全局使用的变量在 add_subdirectory之前使用
add_subdirectory ("Reactor")
add_subdirectory ("Chat")
add_subdirectory ("WxServer")
add_subdirectory ("ReactorTest")
